export const initState = {
    info: sessionStorage.getItem("info") ? JSON.parse(sessionStorage.getItem("info")) : {}
}
//修改
export const reducer = (state, action) => {
    switch (action.type) {
        case "changeInfo":
            return {
                ...state,
                info:action.info
            }
        default:
            return state;
    }

}
//actions
export const actions = {
    changeInfo: info => {
        if (info.token) {
            sessionStorage.setItem("info", JSON.stringify(info))
        } else {
            sessionStorage.removeItem("info")
        }

        return { type: "changeInfo", info }
    }
}